case 1 if browse then WshShell.Run "http://localhost/" & vBaseDir.Name
End Select
End if
Else
Set WshShell = WScript.CreateObject("WScript.Shell")
BtnCode = WshShell.Popup("Virtual directory http://localhost/" & vBaseDir.Name & " already exists. Do you want to delete and create a new one?", 0, "ASPMaker", 4 + 32)
Select Case BtnCode
case 6 ' Yes
DeleteVDir vBaseName
CreateVDir()
case 7 ' No
If browse Then WshShell.Run "http://localhost/" & vBaseDir.Name
End Select
End If
End Sub
Sub DeleteVDir(vBaseName)
Dim vRoot,vBaseDir,webSite,WshShell
On Error Resume Next
' get the local host default web
set webSite = GetObject("IIS://localhost/w3svc/1")
if IsObject(webSite)=False then
WScript.Echo "Error Code: " & Hex(Err) & " - " & "Unable to locate the Default Web Site. IIS must be installed and running."
exit sub
else
'display webSite.name
end if
' get the root
set vRoot = webSite.GetObject("IIsWebVirtualDir", "Root")
If (Err <> 0) Then
WScript.Echo "Error Code: " & Hex(Err) & " - " & "Unable to access root for " & webSite.ADsPath
Exit sub
else
'display vRoot.name
End If
Err.Number = 0 'Clear Error
Set vBaseDir = GetObject(vRoot.ADsPath & "/" & vBaseName)
If Err.Number = 0 Then
vRoot.Delete "IIsWebVirtualDir", vBaseName
'If Err = 0 Then
' Set WshShell = WScript.CreateObject("WScript.Shell")